import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceHistoryVO, DeviceHistoryForm, DeviceHistoryQuery } from '@/api/zntx-app/deviceHistory/types';

/**
 * 查询历史状态列表
 * @param query
 * @returns {*}
 */

export const listDeviceHistory = (query?: DeviceHistoryQuery): AxiosPromise<DeviceHistoryVO[]> => {
  return request({
    url: '/zntx-app/deviceHistory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询历史状态详细
 * @param id
 */
export const getDeviceHistory = (id: string | number): AxiosPromise<DeviceHistoryVO> => {
  return request({
    url: '/zntx-app/deviceHistory/' + id,
    method: 'get'
  });
};

/**
 * 新增历史状态
 * @param data
 */
export const addDeviceHistory = (data: DeviceHistoryForm) => {
  return request({
    url: '/zntx-app/deviceHistory',
    method: 'post',
    data: data
  });
};

/**
 * 修改历史状态
 * @param data
 */
export const updateDeviceHistory = (data: DeviceHistoryForm) => {
  return request({
    url: '/zntx-app/deviceHistory',
    method: 'put',
    data: data
  });
};

/**
 * 删除历史状态
 * @param id
 */
export const delDeviceHistory = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zntx-app/deviceHistory/' + id,
    method: 'delete'
  });
};
